function showDSStatistics(obj) {
	if (refreshTab('showDSStatistics' + obj.eid + '_' + obj.cid))
		return;
	getDSCharPidSet({
				eid : obj.eid,
				success : onload
			});
	function onload(data) {
		var toolbar = new Ext.Toolbar({
					items : [new Ext.Button({
										text : '刷新',
										iconCls : 'refresh-icon',
										handler : function() {
											store.reload();
										}
									}), new Ext.Toolbar.Separator(),
							new Ext.Button({
										text : '打包实验代码',
										iconCls : 'backup-icon',
										handler : function() {
											alertx('暂未实现');
											// packageDSCode(obj);
										}
									}), new Ext.Button({
										text : '打包实验报告',
										iconCls : 'backup-icon',
										handler : function() {
											alertx('暂未实现');
											// packageDSReport(obj);
										}
									}), new Ext.Button({
										text : '评分',
										iconCls : 'point-icon',
										disabled : true,
										handler : function() {
											onPoint();
										}
									})]
				});

		var storeArr = ['no', 'sid', 'name', 'sex', 'accept', 'total', 'report']
				.concat(data.charPidSet);
		var cmArr = [{
					header : '序号',
					sortable : false,
					dataIndex : 'no'
				}, {
					header : '学号',
					sortable : false,
					dataIndex : 'sid'
				}, {
					header : '姓名',
					sortable : false,
					dataIndex : 'name'
				}, {
					header : '性别',
					sortable : false,
					dataIndex : 'sex',
					renderer : sys.rd.sex
				}];

		for (var i = 0; i < data.charPidSet.length; ++i) {
			storeArr.push(data.charPidSet[i] + '_sim', data.charPidSet[i]
							+ '_simrid');
			cmArr.push({
						header : data.charPidSet[i],
						sortable : false,
						dataIndex : data.charPidSet[i],
						renderer : rightrender
					});
		}
		cmArr.push({
					header : '完成',
					sortable : false,
					dataIndex : 'accept'
				}, {
					header : '报告',
					sortable : false,
					dataIndex : 'report',
					renderer : reportRender
				}, {
					header : '评分',
					sortable : false,
					dataIndex : 'point',
					renderer : pointRender
				});
		var cm = new Ext.grid.ColumnModel(cmArr);
		var sm = new Ext.grid.RowSelectionModel({
					singleSelect : true
				});
		var store = new Ext.data.Store({
					proxy : new Ext.data.HttpProxy({
								url : url.getDSStatistics
							}),
					reader : new Ext.data.JsonReader({
								root : 'result',
								totalProperty : 'total',
								id : 'sid'
							}, storeArr)
				});

		var grid = new Ext.grid.GridPanel({
					id : 'showDSStatistics' + obj.eid + '_' + obj.cid,
					title : '实验统计',
					iconCls : 'userlist-icon',
					closable : true,
					region : 'center',
					loadMask : {
						msg : '统计中...'
					},
					viewConfig : {
						forceFit : true
					},
					store : store,
					cm : cm,
					sm : sm,
					tbar : toolbar
				});
		sm.on('selectionchange', onSelect);
		grid.onRefresh = onRefresh;
		addTab(grid);

		store.load({
					params : {
						eid : obj.eid,
						cid : obj.cid
					}
				});
		function getSelect() {
			if (sm.getCount() == 0)
				return null;
			return sm.getSelected();
		}
		function onSelect() {
			var record = getSelect();
			var disable = !record;
			toolbar.get(4).setDisabled(disable);
		}
		function onRefresh() {
			store.reload();
		}
		function onPoint() {
			var record = getSelect();
			submitPoint(record.data.sid)
		}
		function reportRender(value,p,record){
			if(!value)
			return '';
			return String.format(
							'<a href="javascript:void(0);" onclick="getReport({0},{1},{2});" class="likelink" style="color:black;font-weight:bold">√</a>',
							record.data.content, data.eid, record.data.sid);
		}
		function rightrender(value, p, record) {
			if (Ext.isEmpty(value))
				return '';
			return String
					.format(
							'<a href="javascript:void(0);" onclick="cmpCode({0},{1});" class="likelink" style="color:black;font-weight:bold">√ ({2}%)</a>',
							record.data.sid, record.data[value + '_sim'],
							(parseInt(record.data[value + '_sim'] * 10000.0
									+ 0.5) / 100.0).toString());
		}
		function pointRender(value,p,record){
			if(Ext.isEmpty(value))
			return '';
			return value;
		}
	}
}

function getDSCharPidSet(obj) {
	ajax({
				url : url.getDSCharPidSet,
				params : {
					eid : obj.eid
				},
				success : obj.success
			});
}
